<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link href="../../css/reset.css" rel="stylesheet" type="text/css"/>
    <link href="../../css/add.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="app">
    <div class="header">
        <span>修改快递员</span>
    </div>
    <div class="content">
        <table>
            <tr>
                <td class="text-right">手机号码</td>
                <td class="content_right">
                    <input class="input inline-input" id="number" placeholder="请输入手机号码">
                    <button class="btn btn-info" id="find">立即查找</button>
                </td>
            </tr>
        </table>
    </div>


    <div class="header">
        <span>查找信息如下</span>
    </div>
    <div class="content">
        <table>
            <tr>
                <td class="text-right">姓名</td>
                <td class="content_right"><input class="input" placeholder="姓名"></td>
            </tr>
            <tr>
                <td class="text-right">手机号码</td>
                <td class="content_right"><input class="input" placeholder="手机号码"></td>
            </tr>
            <tr>
                <td class="text-right">身份证号码</td>
                <td class="content_right"><input class="input" placeholder="身份证号码"></td>
            </tr>
            <tr>
                <td class="text-right">密码</td>
                <td class="content_right"><input class="input" placeholder="密码"></td>
            </tr>
            <tr>
                <td></td>
                <td class="content_right">
                    <button class="btn btn-info" id="update">立即修改</button>
                    <button class="btn" id="reset">重置</button>
                </td>
            </tr>
        </table>
    </div>
</div>
</body>

<script src="/admin/qrcode/jquery2.1.4.js"></script>
<script src="/admin/layer/layer.js"></script>
<script>
    $(function () {
        $(".header:eq(1),.content:eq(1)").hide();
        $("#find").click(function () {
            var windowId = layer.load();
            var phone =  $("#number").val();
            /**
             {
                 "status":0,
                 "data":{
                    "id":82,
                    "name":"小鬼",
                    "phone":"15523834455",
                    "idNumber":"513437890335219333",
                    "passWord":"789",
                    "deliveryNumber":"5",
                    "registeredTime":"May 27, 2021, 10:55:19 AM",
                    "status":0
                }
            }
             */
            $.getJSON("/EDelivery/find.do", {phone: phone}, function (data) {
                layer.close(windowId);
                if (data.status == 0) {
                    $(".header:eq(1),.content:eq(1)").fadeIn(1000);
                    $("input:eq(1)").val(data.data.name);
                    $("input:eq(2)").val(data.data.phone);
                    $("input:eq(3)").val(data.data.idNumber);
                    $("input:eq(4)").val(data.data.passWord);

                } else {
                    $(".header:eq(1),.content:eq(1)").hide(300);
                    layer.msg(data.result);
                }
            });
        });

        $("#reset").click(function () {
            $("input:eq(1)").val("");
            $("input:eq(2)").val("");
            $("input:eq(3)").val("");
            $("input:eq(4)").val("");
        });

        $("#update").click(function () {
            var windowId = layer.load();
            var name = $("input:eq(1)").val();
            var phone = $("input:eq(2)").val();
            var idnumber = $("input:eq(3)").val();
            var password = $("input:eq(4)").val();
            var number =  $("#number").val();

            $.getJSON("/EDelivery/update.do", {
                name: name,
                phone: phone,
                idnumber: idnumber,
                password: password,
                number: number
            }, function (data) {
                layer.close(windowId);
                layer.msg(data.result);
                if (data.status == 0){
                    $("input:eq(0)").val("");
                    $(".header:eq(1),.content:eq(1)").hide(300);
                }
            });

        });
    });
</script>
</html>
